﻿<!doctype html>
<html>
<head>
    <meta charset="utf-8">

    <title>attachEvent中this变window问题</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
            font-family: "微软雅黑", "张海山锐线体简"
        }

    </style>
    <script>
        window.onload = function () {
            var oBtn = document.getElementById('btn1');
            oBtn.attachEvent('onclick', function () {
                alert(this);	// 报错找不着
            });
        };
    </script>
</head>

<body>

<input type="button" value="按钮" id="btn1">

</body>
</html>
